#define __DEBUG_NEW_H__
#include "DebugNew.h"

#include <list>
#include <vector>
#include <map>
#include <stdio.h>

#undef __DEBUG_NEW_H__
#include "DebugNew.h"

void list_test()
{
  printf("\nlist_test\n");
  std::list<int>* intList = new std::list<int>;

  intList->push_back(1);
  intList->push_back(2);
  intList->push_back(3);

  //intList.clear(); // memory leak
}

void vector_test()
{
  printf("\nvector_test\n");
  std::vector<int>* intVector = new std::vector<int>;

  intVector->push_back(1);
  intVector->push_back(2);
  intVector->push_back(3);

  //intVector.clear(); // memory leak
}

void map_test()
{
  printf("\nmap_test\n");
  std::map<int, int>* intMap = new std::map<int, int>;

  (*intMap)[1] = 100;
  (*intMap)[2] = 200;
  (*intMap)[3] = 300;

  //intMap.clear(); // memory leak
}


#include "MemoryLeak.h"
void stl_test()
{
  MemoryLeak::start();
  list_test();
  MemoryLeak::stop();

  MemoryLeak::start(false);
  vector_test();
  MemoryLeak::stop();

  MemoryLeak::start();
  map_test();
  MemoryLeak::stop();
}
